package cn.com.elite;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;


public class test {
	public static void main(String[] args){
		try{
			String Parm="";
			Parm=Parm+"&Guid=123";
			Parm=Parm+"&HeadStr=Content-Type:text/xml; Charset=UTF-8|#|Host:192.168.2.117:8080|#|SOAPAction:'http://192.168.2.107:8080/test/account'";
			Parm=Parm+"&URL=http://192.168.2.117:8080/TestWebService/services/mywebservice?wsdl";
			Parm=Parm+"&Method=POST";
			Parm=Parm+"&FromCode=UTF-8";
			Parm=Parm+"&ToCode=UTF-8";
			Parm=Parm+"&Content=";
			String a="<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' " +
					"xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' " +
					"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
					"xmlns:xsd='http://www.w3.org/2001/XMLSchema'><SOAP-ENV:Body><m:account xmlns:m='http://test'><m:in0>我</m:in0><m:in1>3</m:in1></m:account></SOAP-ENV:Body></SOAP-ENV:Envelope>";
			
//			String a=" Content=<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:q0='http://tempuri.org/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><soapenv:Body><q0:CreateAndUpdateCustomer> <q0:persPersonId>4386071</q0:persPersonId> <q0:type_id>6</q0:type_id> <q0:persMobile>78978978905</q0:persMobile> <q0:persName>test0409--55</q0:persName>  <q0:persGender>Female</q0:persGender> <q0:persPhoneNumber></q0:persPhoneNumber> <q0:leadSource>Tout</q0:leadSource> <q0:leadChannel>promote</q0:leadChannel> <q0:leadChanSecterr>1879048186</q0:leadChanSecterr> <q0:leadMchannelId>56043</q0:leadMchannelId> <q0:leadPromoterTypes>NULL</q0:leadPromoterTypes> <q0:leadPromoter></q0:leadPromoter> <q0:leadCallResult>LostCall</q0:leadCallResult> <q0:leadNextTimeToCall>2012-04-10 19:03:26</q0:leadNextTimeToCall><q0:leadStatus>TMKFirstFollowUp</q0:leadStatus> <q0:leadSecTerr>1879048187</q0:leadSecTerr> <q0:leadCuspromiseDate>2012-04-10 19:03:26</q0:leadCuspromiseDate><q0:persCondition></q0:persCondition><q0:persRemark>T: 您好!请问您是***小姐/先生吗？</q0:persRemark> <q0:leadTmk>lamer</q0:leadTmk> <q0:persCreatedBy>lamer</q0:persCreatedBy> <q0:leadCreatedDate>2012-04-09 16:53:58</q0:leadCreatedDate> <q0:persUpdatedBy>lamer</q0:persUpdatedBy>  <q0:leadUpdatedDate>2012-04-09 19:03:44</q0:leadUpdatedDate> </q0:CreateAndUpdateCustomer></soapenv:Body></soapenv:Envelope>    ";
//			
			
			Parm=Parm+URLEncoder.encode(a,"UTF-8");
			URL url=new URL("http://localhost:8080/EliteForward/GetInfo");
			HttpURLConnection conn=(HttpURLConnection)url.openConnection();
			conn.setRequestMethod("POST");
			conn.setUseCaches(false);
			conn.setInstanceFollowRedirects(true);
			conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
			conn.setConnectTimeout(30000);
			conn.setReadTimeout(30000);
			conn.setDoOutput(true);
			conn.connect();
			DataOutputStream out = new DataOutputStream(conn.getOutputStream()); 
			out.writeBytes(Parm); 		
	        out.flush();
	        out.close();
	        BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream(),"utf-8"));//设置编码,否则中文乱码
	        conn.disconnect();
		}catch(Exception e){
			e.printStackTrace();
		}
	}

}
